//var iconList = null;
var iconListComponent = null;
function createIconList() {
    console.log("createIconList");
//    if(iconList != null)
//        delete iconList;
    if(iconListComponent != null)
        delete iconListComponent;
    icon_list = null;
    iconListComponent = null;
    iconListComponent = Qt.createComponent("IconList.qml");
    if (iconListComponent.status == Component.Ready)
    {
        finishCreation();
    }
    else if (iconListComponent.status == Component.Error)
    {
        console.log("component Error:", iconListComponent.errorString());
    }
    else{
        iconListComponent.statusChanged.connect(finishCreation);
    }
}

function finishCreation()
{
    console.log("finishCreation");
    if (iconListComponent.status == Component.Ready) {
        //icon_list = iconListComponent.createObject(mainWindow);
        console.log("iconList = " + iconList);
    }
    else if (iconListComponent.status == Component.Error) {
        console.log("Error loading component:", iconListComponent.errorString());
    }
}
